import axios from 'axios';
import { API_GAME_URL } from '@/config/api';
import { AnyObject, HttpResponse } from '@/types/global';
import { GameSingleReward } from '@/types/game-single-reward';

const BASE_URL = `${API_GAME_URL}/single/reward`;

export function getRewardList(gameId: string) {
  return axios.post<HttpResponse<GameSingleReward[]>>(
    `${BASE_URL}/list?gameId=${gameId}`
  );
}

export function updateReward(id: number, data: AnyObject) {
  return axios.put(`${BASE_URL}/${id}`, data);
}

export function deleteReward(id: number) {
  return axios.delete(`${BASE_URL}/${id}`);
}

export function createReward(data: AnyObject) {
  return axios.post(`${BASE_URL}`, data);
}
